package com.ztk.threadbasic.excel;

import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import org.apache.commons.compress.utils.Lists;

import java.util.List;

public class EasyExcelDemo {
    public static void main(String[] args) {
        List<DemoVO> dataList = Lists.newArrayList();

        EasyExcel.read("D:\\学生信息表.xlsx", DemoVO.class, new AnalysisEventListener<DemoVO>() {
            @Override
            public void invoke(DemoVO data, AnalysisContext analysisContext) {
                dataList.add(data);
            }

            @Override
            public void doAfterAllAnalysed(AnalysisContext analysisContext) {
                System.out.println("读取完成");
            }
        }).sheet().doRead();

        dataList.forEach(System.out::println);

    }
}
